Skip to content

fix(models): support Node 26 type stripping - #4076

Open
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/node26-model-metadata
Open

fix(models): support Node 26 type stripping#4076
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/node26-model-metadata

Conversation

@orangeCatDeveloper

Copy link
Copy Markdown
Contributor

Summary

npm run check:model-metadata fails on supported Node 26 releases before it can validate either committed generated module.

Node 26 removed the transform mode from module.stripTypeScriptTypes(), while the metadata checker still requested it. The generated metadata and pricing modules use erasable TypeScript syntax, so the supported strip mode is sufficient on both Node 22.19 and Node 26.

Use strip and add a regression test that converts and imports both committed generated modules before asserting their runtime exports.

Evidence

Before (Node v26.5.0):
TypeError [ERR_INVALID_ARG_VALUE]: The property 'options.mode' must be one of: 'strip'. Received 'transform'
    at loadTypeScriptModule (scripts/sync-model-metadata.mjs:500:22)

After (Node v26.5.0):
✔ loads the committed generated TypeScript modules
ℹ pass 1
ℹ fail 0

After (Node v22.19.0):
ok 1 - loads the committed generated TypeScript modules
# pass 1
# fail 0

Verification

  • npm run check:model-metadata on Node 26.5.0
  • npx --yes node@22.19.0 scripts/sync-model-metadata.mjs --check
  • node --test scripts/sync-model-metadata.test.mjs — 9/9 passed
  • npm run lint
  • npm run format:check
  • node scripts/asf-license-headers.mjs check
  • git diff --check

Full build and typecheck were not run for this script-only draft.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex implemented the Node compatibility change, regression test, and PR description.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@orangeCatDeveloper
orangeCatDeveloper marked this pull request as ready for review August 28, 2026 09:44
@github-actions github-actions Bot added the effort/S Under 100 readable lines label Aug 28, 2026

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at exact head 605a995ec6a18b3d4cb98fa29b504aeb8f2770ea. I found no P0–P2 issues.

The problem is real on the supported Node range: Node 26 rejects stripTypeScriptTypes(..., { mode: 'transform' }), preventing the metadata and release checks from loading their committed generated modules. Those modules use erasable TypeScript syntax, so changing the existing loader to mode: 'strip' is the smallest correct fix and keeps the current validation authority intact.

Non-blocking P3: the added committed-module test overlaps the existing loader/check path and requires exporting an otherwise internal helper. It could be removed, or replaced by a narrow Node 26 CI lane if continuous Node 26 coverage becomes a project requirement. This does not block the production fix.

The exact-head hosted test check is successful.

AI-assisted review: Codex coordinated an @reviewer pass; I verified the exact-head diff, affected authority, CI state, and the final severity judgment. Astro-Han owns this approval decision.

简体中文

精确 head 上没有 P0–P2。Node 26 问题真实存在,改用 strip 是最小正确修复。新增测试与现有检查路径部分重复,属于不阻塞的 P3 简化项。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants